package com.briup.demo.service.impl;

import com.briup.demo.bean.discount;
import com.briup.demo.service.IdiscountService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class discountServiceImpl implements IdiscountService {
    @Resource
    private com.briup.demo.dao.discountMapper discountMapper;
    @Override
    public List<discount> findAll() {
        return discountMapper.selectAll();
    }

    @Override
    public void saveOrUpdate(discount discount) {
            if (discount.getId() != null) {
                discountMapper.update(discount);
            }
            else {
                discountMapper.insert(discount);
            }
    }

    @Override
    public void delete(Long id) {
     discountMapper.delete(id);
    }
}
